package com.demo.tankGame2;

import javax.swing.*;

/**
 * 绘制画框 放入 画板
 * @author gy
 * @date 2022/4/18
 */
public class YgyTankGame03 extends JFrame{

    private MyPanel mp = null;

    /**
     * 主启动类，将画框 启动起来
     * @param args
     */
    public static void main(String[] args) {
        YgyTankGame03 ygyTankGame03 = new YgyTankGame03();
    }


    public YgyTankGame03() {
        this.mp = new MyPanel();
        // 启动 MyPanel线程，重新绘制面板
        Thread panelThread = new Thread(mp);
        panelThread.setName("画板");
        panelThread.start();

        this.add(mp);
        this.setSize(1000,750);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.addKeyListener(mp);// 让JFrame 监听键盘事件
        this.setVisible(true);
    }
}
